package com.zc.im.seqsvr.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.zc.im.common.constant.RedisPrefixConstant;
import com.zc.im.common.constant.StepConstant;
import com.zc.im.seqsvr.domain.UserSeq;
import com.zc.im.seqsvr.repository.UserSeqRepository;
import com.zc.im.seqsvr.script.LuaScript;
import com.zc.im.seqsvr.service.UserSeqService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.ReactiveStringRedisTemplate;
import org.springframework.data.relational.core.query.Criteria;
import org.springframework.data.relational.core.query.Query;
import org.springframework.data.relational.core.query.Update;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * Project：im
 * Date：2022/4/13
 * Time：18:51
 * Description：UserSeq service实现类
 *
 * @author Challen.Zhang
 * @version 1.0
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class UserSeqServiceImpl extends AbstractBaseServiceImpl<UserSeq, Long, UserSeqRepository> implements UserSeqService {

    @Override
    public Mono<Integer> updateSeq(Long userId, Long seq) {
        return update(Query.query(Criteria.where("id").is(userId)), Update.update("current_seq", seq));
    }

}
